<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>个人中心</title>
<link rel="stylesheet" href="${ctxStatic }/gov/js/personal.css" />
<link rel="stylesheet" href="${ctxStatic }/gov/My97DatePicker/govsk/skin/WdatePicker.css" />
<link rel="stylesheet" href="${ctxStatic }/gov/css/gov_total.css" />
<script src="${ctxStatic }/jquery/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${ctxStatic }/gov/js/jquery.validate.js" ></script>
<script type="text/javascript" src="${ctxStatic }/gov/js/messages_zh.js" ></script>
<script>
$(function(){
	
	/*信息设置验证*/
	
$('#personal-imf').validate({
rules:{
	name:"required",
 	mobile:{
			required:true,
			isMobile : true
		},
	email:{
	      	required:true,
			email : true
}
},	    
messages:{
	name: "<i class='verico'></i>请输入用户昵称",
	mobile:{
			required:"<i class='verico'></i>请输入手机号码",
			isMobile :"<i class='verico'></i>请输入正确手机号码"
		},
	email:{
			 required:"<i class='verico'></i>请输入您的邮箱" ,
             email:"<i class='verico'></i>请输入正确的邮箱地址" 
		}
},
});	
		/*手机验证*/
    jQuery.validator.addMethod("isMobile", function(value, element) {
        var length = value.length;
        var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
        return this.optional(element) || (length == 11 && mobile.test(value));
    }, "请正确填写您的手机号码");


/*密码重置验证*/
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});    
/* $('#personal-passwoard').validate({
 rules:{
	 oldPassword:"required",
	 newPassword:{
		    required: true,  
            minlength:6,  
            same:true  
		},
	repeatPassword:{
	     required: true,
	     equalTo: "#password-new" 
}
},	    
messages:{
	oldPassword:"<i class='verico'></i>请输入旧密码",
	newPassword:{
			required:"<i class='verico'></i>请输入您的新密码",
            minlength: '<i class="verico"></i>密码长度至少6位',  
            same:'<i class="verico"></i>新密码不能与旧密码一样' 
		},
	repeatPassword:{
			  required: "<i class='verico'></i>请输入确认新密码",  
			  equalTo: "<i class='verico'></i>两次输入密码不一致" 
		}
},
	   
});	 */


jQuery.validator.addMethod("same", function(value, element) {  
        return this.optional(element) || same(value);  
    }, "新密码不能与老密码重复");  

    function same(pwd) {  
        var oldPwd = $("#password-rig").val();  
        if (oldPwd == pwd)  
            return false;  
        else  
            return true;  
    }  

})
</script>
</head>
<body>
		 <%@include file="../index/head.jsp" %>
	 <div id="personal">
		 	 	<div class="personal_main">
		 	 		<div class="personalbody">
		 	 	   	      <div class="personal_tit">
		 	 	   	      	    <span class="pers-setup">信息设置</span>
		 	 	   	      	    <span class="pers-rest">密码重置</span>
		 	 	   	      </div>
		 	 	   	      <div class="personal_box">
		 	 	   	      	 <form id="personal-imf" action="${ctxGov }/savePersonal" method="post">
		 	 	   	      	 	 <label>
		 	 	   	      	 	 	 <span>昵称：</span>
		 	 	   	      	 	 	 <input type="text" placeholder="请输入您的昵称" id="persname" name="name" value="${nick }"/>
		 	 	   	      	 	 </label>
		 	 	   	      	 	 <label>
		 	 	   	      	 	 	 <span>邮箱：</span>
		 	 	   	      	 	 	 <input type="text" placeholder="请输入您的邮箱" id="perseamil" name="email" value="${email}"/>
		 	 	   	      	 	 </label>
		 	 	   	      	 	 <label>
		 	 	   	      	 	 	 <span>常用联系电话：</span>
		 	 	   	      	 	 	 <input type="text" placeholder="请输入常用联系电话" id="persphone" name="mobile" value="${mobile }"/>
		 	 	   	      	 	 </label>
		 	 	   	      	 	 <div class="date_le">
		 	 	   	      	 	 	  <input type="submit" value="保存">
		 	 	   	      	 	 </div>
		 	 	   	      	 </form>
		 	 	   	      	 <form id="personal-passwoard" action="${ctxGov }/modifyPwd" method="post">
		 	 	   	      	 	 <label>
		 	 	   	      	 	 	 <span>原始密码：</span>
		 	 	   	      	 	 	 <input type="password" placeholder="请输入您的原始密码" id="password-rig" name="oldPassword"/>
		 	 	   	      	 	 </label>
		 	 	   	      	 	 <label>
		 	 	   	      	 	 	 <span>新密码：</span>
		 	 	   	      	 	 	 <input type="password" placeholder="请输入您的新密码" id="password-new" name="newPassword"/>
		 	 	   	      	 	 </label>
		 	 	   	      	 	 <label>
		 	 	   	      	 	 	 <span>确认密码：</span>
		 	 	   	      	 	 	 <input type="password" placeholder="请确认您的新密码" id="password-system" name="repeatPassword"/>
		 	 	   	      	 	 </label>
		 	 	   	      	 	 <div class="date_le">
		 	 	   	      	 	 	  <input type="submit" value="确认修改" id="btn">
		 	 	   	      	 	 </div>
		 	 	   	      	 </form>
		 	 	   	     </div>
		 	 	</div>
		 	 </div>
		 </div>
		 <%@include file="../index/foot.jsp" %>
	</body>
 </html>